<include file="header"/>
<body>
<div class="wraper">
	<div class="head clearfix">
		<a href="javascript:history.go(-1);" class="iconfont icon-fanhui72 pull-left"></a>
		<span class="head-name pull-left">订单详情</span>
	</div>
	
	<if condition="(($data['solution'] eq 0) AND ($data['status'] eq 1))">
		<div class="order-mes">
			<p class="main-text">待商家确认订单</p>
			<p>订单编号 ：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		<input name="orderid" class="orderid" type="hidden"/>
	
	<elseif condition="(($data['solution'] eq 0) AND ($data['status'] eq 3))"/>
		<!--已取消-->
		<div class="order-mes">
			<p class="main-text">已取消</p>
			<p>订单编号 ：{BEESCRM:$data.order_sn}</p>
			<p>取消时间：{BEESCRM:$data.cancel_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		
	<elseif condition="(($data['solution'] eq 1) AND ($data['status'] eq 1))"/>
		<!--待方案-->
		<div class="order-mes">
			<p class="main-text">待服务商提供方案</p>
			<p>订单编号 ：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		<input name="orderid" class="orderid" type="hidden"/>
		<!--待方案-->
		<div class="wait">
			<p>服务商正在讨论方案</p>
			<p>请耐心等待~</p>
		</div>
		<div class="btn-box text-center">
			<a href="javascript:;" class="btn btn-blue cancelAppoint" data-orderid="{BEESCRM:$data.order_id}">取消预约</a>
		</div>
		
	<elseif condition="$data['status'] eq 4"/>
		<!--待评价-->
		<div class="order-mes">
			<p class="main-text">待评价</p>
			<p>订单编号 ：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
	
	<elseif condition="$data['status'] eq 5"/>
		<!--待评价-->
		<div class="order-mes">
			<p class="main-text">已评价</p>
			<p>订单编号 ：{BEESCRM:$data.order_sn}</p>
			<p>完成时间：{BEESCRM:$data.finish_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>	
	
	<elseif condition="(($data['solution'] eq 1) AND ($data['status'] eq 2))"/>
		<!--待验收-->
		<div class="order-mes">
			<p class="main-text">服务商已提供方案，请确认…</p>
			<p>订单编号：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		<input name="orderid" class="orderid" type="hidden"/>
	<elseif condition="(($data['solution'] eq 1) AND ($data['status'] eq 6))"/>
		<!--待验收-->
		<div class="order-mes">
			<p class="main-text">服务商已修改方案，请确认…</p>
			<p>订单编号：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		<input name="orderid" class="orderid" type="hidden"/>
		
	<elseif condition="(($data['solution'] eq 1) AND ($data['status'] eq 7))"/>	
		<div class="order-mes">
			<p class="main-text">待验收</p>
			<p>订单编号：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		<input name="orderid" class="orderid" type="hidden"/>
	<elseif condition="(($data['solution'] eq 0) AND (($data['status'] eq 2) OR ($data['status'] eq 6)))"/>	
		<div class="order-mes">
			<p class="main-text">待验收</p>
			<p>订单编号：{BEESCRM:$data.order_sn}</p>
			<p>下单时间：{BEESCRM:$data.create_time|date='Y-m-d H:i',###}</p>
			<p>摆放地点 ：{BEESCRM:$data.college}{BEESCRM:$data.department}{BEESCRM:$data.address}</p>
			<if condition="$data['type'] neq 2">
				<p>摆放时长：{BEESCRM:$data.use_long}天</p>
				<p>订单类型：长期</p>
			<else/>
				<p>订单类型：会场</p>
			</if>
			<p>摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d',###}</p>
		</div>
		<input name="orderid" class="orderid" type="hidden"/>
	</if>
	
	<!--已提供方案-->
	<!--<div class="order-mes">
		<p class="main-text">服务商已提供方案，请确认…</p>
		<p>订单编号：2313</p>
		<p>成交时间：2015-10-14 08：30</p>
	</div>-->

	<!--已修改方案-->
	<!--<div class="order-mes">
		<p class="main-text">服务商已修改方案，请确认…</p>
		<p>订单编号：2313</p>
		<p>成交时间：2015-10-14 08：30</p>
	</div>-->

	<!--待验收-->
	<!--<div class="order-mes">
		<p class="main-text">待验收</p>
		<p>订单编号：2313</p>
		<p>成交时间：2015-10-14 08：30</p>
	</div>-->

	<!--待评价-->
	<!--<div class="order-mes">
		<p class="main-text">待评价</p>
		<p>订单编号：2313</p>
		<p>成交时间：2015-10-14 08：30</p>
	</div>-->

	<if condition="!(($data['solution'] eq 1) AND ($data['status'] eq 1))">
		<if condition="$data['orderGoods']">
			<volist name="data.orderGoods" id="vo">
			
				<div class="white-block">
					<div class="tb-mode">
						<div class="tb-cell info-left">
							<div class="image-box">
								<img src="{BEESCRM:$vo.goods_image}"/>
							</div>
						</div>
						<div class="tb-cell line-h">
							<p class="text-green">{BEESCRM:$vo.goods_name}</p>
							<if condition="$vo['type'] eq 3">
								<p class="sub-contain">长期摆放: {BEESCRM:$vo.goods_price} 元/盆/天</p>
							<elseif condition="$vo['type'] eq 2"/>
								<p class="sub-contain">会场布置: {BEESCRM:$vo.goods_price} 元/盆/场</p>
							</if>

							<p class="sub-contain">预约数量：{BEESCRM:$vo.goods_num} 盆</p>
							<p class="sub-contain">小计：<span class="text-red">￥{BEESCRM:$vo.goods_price_all}元</span></p>
						</div>
					</div>
					<!-- <p class="font-small">摆放日期：{BEESCRM:$data.use_start_time|date='Y-m-d H:i',###} 至  {BEESCRM:$data.use_end_time|date='Y-m-d H:i',###}</p> -->
				</div>
			</volist>
		</if>
	</if>	
			<if condition="(($data['solution'] eq 0) AND ($data['status'] eq 1))">
				<div class="white-block">预计总费用 <span class="text-red">￥{BEESCRM:$data.order_amount}元</span> </div>
				<div class="btn-box text-center" id="cancel-btn">
					<a href="javascript:;" class="btn btn-blue cancelAppoint"  data-orderid="{BEESCRM:$data.order_id}">取消预约</a>
					<!-- <p class="rest">剩余：12：10</p> -->
				</div>
				
			<elseif condition="$data['status'] eq 3"/>
				<div class="white-block">预计总费用 <span class="text-red">￥{BEESCRM:$data.order_amount}元</span>
					<span class="pull-right text-gray">已取消</span> 
				</div>
			<elseif condition="$data['status'] eq 4"/>
				<!--待评价-->
					<div class="white-block">预计总费用 <span class="text-red">￥{BEESCRM:$data.order_amount}元</span> </div>
					<div class="btn-box text-center">
						<a href="javascript:;" class="btn btn-red comment">立即评价</a>
					</div>
					
					<div class="pop-box comment-box">
						<div class="main">
							<p class="pop-list text-center">评价<span class="iconfont icon-guanbi close pull-right"></span></p>
							<div class="pop-list clearfix">
								<p class="check-list checked" data-content="1"><span class="iconfont icon-xuanzedianjihou"></span>非常满意</p>
								<p class="check-list" data-content="2"><span class="iconfont icon-xuanzedianjihou"></span>满意</p>
								<p class="check-list" data-content="3"><span class="iconfont icon-xuanzedianjihou"></span>不满意</p>
							</div>
							<div class="block-space">
								<textarea maxlength="20" placeholder="请详细描述，不超过20个中文汉字" id="content"></textarea>
							</div>
							<div class="pop-btn">
								<input type="hidden" id="order_id">
								<input type="hidden" id="comment_star" value="1">
								<a href="javascript:void(0);" id="up">确认提交</a>
							</div>
						</div>
					</div>
		<elseif condition="$data['status'] eq 5"/>
				<div class="white-block">预计总费用 <span class="text-red">￥{BEESCRM:$data.order_amount}元</span> </div>
				<div class="white-block">满意度 :
				<span><if condition="$data['comment_star'] eq 1">非常满意
				<elseif condition="$data['comment_star'] eq 2"/>满意
				<elseif condition="$data['comment_star'] eq 3"/>不满意
				</if></span> 
				</div>
				<div class="white-block">评价: <span>{BEESCRM:$data.comment}</span> </div>
				
		<elseif condition="(($data['solution'] eq 1) AND ($data['status'] eq 2)) || (($data['solution'] eq 1) AND ($data['status'] eq 6))"/>
			<!--已提供方案、已修改方案-->
				<div class="btn-box text-center">
					<a href="javascript:void(0);" class="btn btn-red confirmAgree" data-orderid="{BEESCRM:$data.order_id}">确认同意</a>
					<a href="javascript:void(0);" class="btn btn-blue cancelAppoint" data-orderid="{BEESCRM:$data.order_id}">取消预约</a>
					<!-- <p class="rest">剩余：12：10</p> -->
				</div>
		
		<elseif condition="(($data['solution'] eq 1) AND ($data['status'] eq 7))"/>		
			<div class="btn-box text-center">
				<a href="javascript:void(0);" class="btn btn-green confirmAccept" data-orderid="{BEESCRM:$data.order_id}">确认验收</a>
			</div>	
		<elseif condition="(($data['solution'] eq 0) AND ($data['status'] eq 2))"/>	
			<div class="btn-box text-center">
				<a href="javascript:void(0);" class="btn btn-green confirmAccept" data-orderid="{BEESCRM:$data.order_id}">确认验收</a>
			</div>			
		</if>
			
			
		
	
	
	<!-- <div class="white-block">
		<div class="tb-mode">
			<div class="tb-cell info-left">
				<div class="image-box">
					<img src="./images/flower.jpg"/>
				</div>
			</div>
			<div class="tb-cell line-h">
				<p class="text-green">[树植盆景] 发财树</p>
				<p class="sub-contain">长期摆放: 1.5 元/盆/天</p>
				<p class="sub-contain">预约数量：2 盆</p>
				<p class="sub-contain">小计：<span class="text-red">￥130.5元</span></p>
			</div>
		</div>
		<p class="font-small">摆放日期：2015-10-20 至 2016-10-20</p>
	</div>
	<div class="white-block">
		<div class="tb-mode">
			<div class="tb-cell info-left">
				<div class="image-box">
					<img src="./images/flower.jpg"/>
				</div>
			</div>
			<div class="tb-cell line-h">
				<p class="text-green">[树植盆景] 发财树</p>
				<p class="sub-contain">长期摆放: 1.5 元/盆/天</p>
				<p class="sub-contain">预约数量：2 盆</p>
				<p class="sub-contain">小计：<span class="text-red">￥130.5元</span></p>
			</div>
		</div>
		<p class="font-small">摆放日期：2015-10-20 至 2016-10-20</p>
	</div> -->
	<!--已取消-->
	<!--<div class="white-block">预计总费用 <span class="text-red">￥271.0元</span><span class="pull-right text-gray">已取消</span></div>-->
	<!-- <div class="white-block">预计总费用 <span class="text-red">￥{BEESCRM:$allPrice}元</span></div>
	
	<div class="btn-box text-center" id="cancel-btn">
		<a href="javascript:;" class="btn btn-blue cancelAppoint"  data-orderid="{BEESCRM:$data.order_id}">取消预约</a>
		<p class="rest">剩余：12：10</p>
	</div> -->

	<!--待方案-->
	<!--<div class="wait">
		<p>服务商正在讨论方案</p>
		<p>请耐心等待~</p>
	</div>
	<div class="btn-box text-center">
		<a href="#" class="btn btn-blue">取消预约</a>
	</div>-->

	<!--已提供方案、已修改方案-->
	<!--<div class="btn-box text-center">
		<a href="./appoint.html" class="btn btn-red">确认同意</a>
		<a href="#" class="btn btn-blue">取消预约</a>
		<p class="rest">剩余：12：10</p>
	</div>-->

	<!--待验收->
	<!--<div class="btn-box text-center">
		<a href="./appoint.html" class="btn btn-green">确认验收</a>
	</div>-->

	<!--待评价->
	<!--<div class="btn-box text-center">
		<a href="./appoint.html" class="btn btn-red">立即评价</a>
	</div>-->
	<include file="nav"/>
</div>

<include file="commonJs"/>

<script>
	var nav_h = $('.nav').height();
	$('.wraper').css('paddingBottom',nav_h+8);
	var img_h = $('.image-box img').height();
	$('.image-box img').css('marginTop',-img_h/2);
	
	//取消订单请求
	$('.cancelAppoint').click(function(){
		var orderId = $(this).data('orderid');
		/* if(!orderId){
			$.alert('error', '此条订单取消请求参数有误');return ;
		} */
		$('.orderid').val(orderId);
		  $.confirm('确认取消此预约订单？', yesDo);
	});
	function yesDo(){
		var orderId = $('.orderid').val(), jsons = new Object(), data = {};
		data.orderId = orderId;
		jsons.data = data;
		jsons.method = 'post';
		jsons.url = "{BEESCRM::U('base/bonsai/cancelOrder', array('wechat_id' => $wechat_id, 'origin' => $origin))}";
		//console.log(jsons);
		$.getAjax(jsons, true, redirect, '');
		
	}
	
	function delSRemove(data){
		$('#cancel-btn').remove();
		$.alert('success', data.message);
	}

	function redirect(){
		setTimeout("location.href=location.href", 1000);
	}

	$('.btn-red').click(function(){
		$('.comment-box').show();
	});
	$('.close').click(function(){
		$('.comment-box').hide();
	});
	$('.check-list').click(function(){
		$(this).addClass('checked');
		$(this).siblings().removeClass('checked');
		var value = $(this).data('content');
		$("#comment_star").val(value);
	});
	$('#up').click(function(){
		var order_id = "{BEESCRM:$data.order_id}";
		var comment_star = $("#comment_star").val();
		var comment = $("#content").val();
		var data = {}, json = {};
		data.order_id = order_id;
		data.comment_star = comment_star;
		data.comment = comment;
		data.status = 5;
		json.method = 'post';
		json.type = 'json';
		json.url = "{BEESCRM::U('/base/bonsai/changeStatus', array('wechat_id'=>$wechat_id))}";
		json.data = data;
		//console.log(json);return ;
		$.getAjax(json, true, redirect, '');
	});
	
	
	//同意订单请求
	$('.confirmAgree').click(function(){
		var orderId = $(this).data('orderid');
		/* if(!orderId){
			$.alert('error', '此条订单确认同意请求参数有误');return ;
		} */
		$('.orderid').val(orderId);
		$.confirm('确认同意此预约订单？', yesGo);
	});
	
	function yesGo(){
		var orderId = $('.orderid').val(), jsons = new Object(), data = {};
		data.orderId = orderId;
		jsons.data = data;
		jsons.method = 'post';
		jsons.url = "{BEESCRM::U('base/bonsai/agreeOrder', array('wechat_id' => $wechat_id, 'origin' => $origin))}";
		//console.log(jsons);
		$.getAjax(jsons, true, redirect, '');
	}
	
	//confirmAccept
	$('.confirmAccept').click(function(){
		var orderId = $(this).data('orderid');
		/* if(!orderId){
			$.alert('error', '确认验收请求参数有误');return ;
		} */
		$('.orderid').val(orderId);
		$.confirm('确认验收此订单？', yesFire);
	});
	
	function yesFire(){
		var orderId = $('.orderid').val(), jsons = new Object(), data = {};
		data.orderId = orderId;
		jsons.data = data;
		jsons.method = 'post';
		jsons.url = "{BEESCRM::U('base/bonsai/acceptOrder', array('wechat_id' => $wechat_id, 'origin' => $origin))}";
		//console.log(jsons);
		$.getAjax(jsons, true, redirect, '');
	}
	
	
	
</script>
</body>
</html>
